package 工厂模式.简单工厂.service.impl;

import 工厂模式.简单工厂.entity.AwardInfo;
import 工厂模式.简单工厂.entity.ResponseResult;
import 工厂模式.简单工厂.entity.SmallGiftInfo;
import 工厂模式.简单工厂.service.IFreeGoods;

import java.util.UUID;

/**
 * 小礼品
 */
public class SmallGiftFreeGoods implements IFreeGoods {
    @Override
    public ResponseResult sendFreeGoods(AwardInfo awardInfo) {
        SmallGiftInfo smallGiftInfo = new SmallGiftInfo();
        smallGiftInfo.setUserPhone(awardInfo.getExtMap().get("phone"));
        smallGiftInfo.setUserName(awardInfo.getExtMap().get("username"));
        smallGiftInfo.setAddress(awardInfo.getExtMap().get("address"));
        smallGiftInfo.setOrderId(UUID.randomUUID().toString());
        System.out.println("小礼品发放成功，请注意查收："+smallGiftInfo.toString());
        return new ResponseResult("200","小礼品发放成功",smallGiftInfo);
    }
}
